package com.wwz.frame.exception;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
* @Description 特定异常捕捉 @ControllerAdvice+@ExceptionHandler 注解处理异常
* @Author wwz
* @Date 2019/08/15 
* @Param   
* @Return   
*/ 
@RestControllerAdvice
@Component
public class GlobalExceptionHandler {
    @ExceptionHandler(NumberFormatException.class)
    public String NumberFormatException(NumberFormatException exception){
        System.out.println("NumberFormatException");
        return JSONObject.toJSONString(exception);
    }

}
